# Contributor: Leo <thinkabit.ukim@gmail.com>
# Contributor: Jann - Ove Risvik <jann.ove@dev.usaklig.com>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=oath-toolkit
pkgver=2.6.11
pkgrel=2
pkgdesc="OATH Toolkit One-time password components"
url="https://nongnu.org/oath-toolkit/"
arch="all"
license="GPL-3.0-or-later"
makedepends="
	autoconf automake libtool
	gtk-doc
	libxml2-dev
	linux-pam-dev
	xmlsec-dev
	"
subpackages="$pkgname-dev $pkgname-doc $pkgname-liboath $pkgname-libpskc
	$pkgname-oathtool $pkgname-pam_oath"
source="https://download.savannah.gnu.org/releases/oath-toolkit/oath-toolkit-$pkgver.tar.gz
	gcc14.patch"

prepare() {
	default_prepare
	autoreconf -vif
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var
	make
}

package() {
	make DESTDIR="$pkgdir" install
}

liboath() {
	depends=""
	pkgdesc="A shared and static C library for OATH handling."
	license="LGPL-2.1-or-later"

	amove usr/lib/liboath.so.*
}

libpskc() {
	depends=""
	pkgdesc="Library for Portable Symmetric Key Container"
	license="LGPL-2.1-or-later"

	amove usr/lib/libpskc.so.*
}

oathtool() {
	depends=""
	pkgdesc="A command line tool for generating and validating OTPs."
	license="GPL-3.0-or-later"

	amove usr/bin/oathtool
}

pam_oath() {
	depends=""
	license="GPL-3.0-or-later"
	pkgdesc="A PAM module for pluggable login authentication for OATH."

	amove usr/lib/security
}

sha512sums="
42df879bebccdde3d38558ba735e09db14d0c916b9f0d3a1842e0ecc80614b7d1ee44db39d3097970a2a7108446da6eefd09bdd32dd2fb81d6aed06dc19552fd  oath-toolkit-2.6.11.tar.gz
00b2541211fcb38e770d27a1d226d759dfce11c5e65acd64175a5124dc197bfcee24094f222daa4bbe84c1c78b78eac5f26aef3930556dcd3072c5cb5e36d4ab  gcc14.patch
"
